﻿using System;
using enyo;
using onyx;

namespace JenkinsView
{
    public class ConfirmDialog : onyx.Popup
    {
        private new Component[] Components = new Component[]
        {
            new Control() { LayoutKind = enyo.LayoutKind.FittableColumnsLayout, NoStretch = true,
                Components = new Component[]
                {
                    new Icon() { Kind = onyx.ComponentKind.Icon, Src = ImgSrc.WARNING },
                    new Control(){ Content = "Delete server?", Classes = CssConst.MESSAGE }
                }
            },
            new Control() { LayoutKind = enyo.LayoutKind.FittableColumnsLayout, NoStretch = true,
                Components = new Component[]
                {   
                    new Control() { Fit = true },
                    new onyx.Button() { Kind = onyx.ComponentKind.Button, Content = "OK", ontap = "tapOKClose", Classes = CssConst.ONYX_DARK },
                    new onyx.Button() { Kind = onyx.ComponentKind.Button, Content = "Cancel", ontap = "tapCancelClose", Classes = CssConst.ONYX_DARK }
                }
            }
        };

        private void TapOKClose()
        {
            this.Hide();
            DomainModel.Model.ServerManager.RemoveServer();
        }

        private void TapCancelClose()
        {
            this.Hide();
        }
    }
}
